import { useState, useEffect } from 'react'
import { getTypeOnes } from "../../tools/ajax"
import "./HomeTitle.css"


export default () => {
    const [types, setTypes] = useState([]);

    const getTypes = async () => {
        let _arr = types;
        let { data: getTypeOne } = await getTypeOnes()
        _arr.push(...getTypeOne.splice(0, 9))
        setTypes([..._arr]);
        console.log("1111111", types);

    }

    useEffect(function () {
        getTypes()

    }, [])

    console.log("22222222", types);
    return (
        <div className="home-title">
            {types.map((item, i) => {
                return (
                    <div className='title-item' key={i}>
                        {item}
                    </div>
                );
            })}
        </div>
    );
}